import DrugStatusEnum from "@/enums/DrugStatusEnum";
import {
  search
} from '/src/api/pharmacy/drug'
import {
  search as drugTypeSearch
} from '/src/api/drug/drugType'
import {
  search as drugUnitSearch
} from '/src/api/drug/drugUnit'
import {
  search as drugDecoctionSearch
} from '/src/api/drug/drugDecoction'


/**
 * @param label 表头
 * @param prop 字段名
 * @param isSearch 是否筛选项
 * @type {[{isSearch: boolean, prop: string, label: string},{isSearch: boolean, prop: string, label: string},{isSearch: boolean, prop: string, label: string},{isSearch: boolean, prop: string, label: string, enum: {0: string, 1: string, 2: string}}]}
 */
const tableColumn = [{
    label: "处方单号",
    prop: "drug_code",
    isSearch: true,
    isTable: true,
    formType: "input"
  }, {
    label: "处方编号",
    prop: "drug_type",
    isTable: true,
    isSearch: true,
    formType: "input",
  }, {
    label: "状态",
    prop: "name",
    isTable: true,
    isSearch: true,
    formType: "select",
    multiple: true,
    asyncSelDataApi: drugTypeSearch,
    asyncSelData: []
  }, {
    label: "药态",
    prop: "name2",
    isTable: true,
    isSearch: true,
    formType: "select",
    multiple: true,
    asyncSelDataApi: drugTypeSearch,
    asyncSelData: []
  },{
    label: "患者姓名",
    prop: "username",
    isSearch: true,
    isTable: true,
    formType: "input"
  }, {
    label: "审方时间",
    prop: "pinyin_abbr",
    isTable: true,
    isForm: true,
    formType: "input",
    multiple: true,
    required: true,
    min: 0,
    max: 200,
    tips: "可输入多个，请用“,”隔开"
  }, {
    label: "药品类型",
    prop: "drug_type_name",
    isTable: true
  }, {
    label: "药态",
    prop: "alias",
    isTable: true,
    isForm: true,
    formType: "input",
    min: 0,
    max: 200,
    tips: "可输入多个，请用“,”隔开"
  }, {
    label: "地址",
    prop: "alias_spelling",
    isForm: true,
    formType: "input",
    required: true,
    min: 0,
    max: 500,
    tips: "可输入多个，请用“,”隔开"
  }, {
    label: "状态",
    prop: "pinyin_alias",
    isTable: true,
    isForm: true,
    formType: "input",
    min: 0,
    max: 200,
    tips: "可输入多个，请用“,”隔开"
  }, {
    label: "锁方状态",
    prop: "status",
    isTable: true,
    isSearch: true,
    formType: "radio",
    defaultValue: 0,
    enum: DrugStatusEnum
  }, {
    label: "锁方时间",
    prop: "drug_decoction_id",
    isForm: true,
    formType: "select",
    asyncSelDataApi: drugDecoctionSearch,
    asyncSelData: []
  }, {
    label: "锁方原因",
    prop: "unit_id",
    isTable: true,
    isForm: true,
    formType: "select",
    required: true,
    asyncSelDataApi: drugUnitSearch,
    asyncSelData: []
  }
  // {
  //   label: "最大用量",
  //   prop: "max_use",
  //   isForm: true,
  //   formType: "number",
  //   min: 1,
  //   max: 1000,
  //   tips: "g"
  // }, {
  //   label: "最小用量",
  //   prop: "min_use",
  //   isForm: true,
  //   formType: "number",
  //   min: 1,
  //   max: 1000,
  //   tips: "g"
  // }, {
  //   label: "是否毒麻药",
  //   prop: "is_toxic",
  //   isForm: true,
  //   formType: "switch",
  // }, {
  //   label: "相似药品",
  //   prop: "similar_drug",
  //   isForm: true,
  //   formType: "select_remote",
  //   selectRemoteKey: "name",
  //   multiple: true,
  //   selectRemoteOptions: {},
  //   asyncSelDataApi: search,
  //   asyncSelData: []
  // }, {
  //   label: "禁忌病种",
  //   prop: "taboo_diseases",
  //   isForm: true,
  //   formType: "input",
  //   min: 0,
  //   max: 500,
  //   tips: "可输入多个，请用“,”隔开"
  // }, {
  //   label: "创建时间",
  //   prop: "created_at",
  //   isTable: true,
  // }, {
  //   label: "创建人",
  //   prop: "created_name",
  //   isTable: true,
  // }, {
  //   label: "修改时间",
  //   prop: "updated_at",
  //   isTable: true,
  // }, {
  //   label: "修改人",
  //   prop: "updated_name",
  //   isTable: true,
  // }, {
  //   label: "备注",
  //   prop: "remark",
  //   isForm: true,
  //   formType: "textarea",
  //   min: 0,
  //   max: 500
  // },
]
const tableConfig = {
  buttons: ["view", "edit", "status", "batchStatus"],
  statusText: ["上架", "下架"],
  isBatchId: true
}
const pageConfig = {
  small: false,
  disabled: false,
  background: false,
}

export {
  tableColumn,
  tableConfig,
  pageConfig
};